package org.qpcr.community.project.model.entity;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.hswebframework.ezorm.rdb.mapping.annotation.Comment;
import org.hswebframework.ezorm.rdb.mapping.annotation.DefaultValue;
import org.hswebframework.web.api.crud.entity.GenericEntity;
import org.hswebframework.web.api.crud.entity.RecordCreationEntity;
import org.hswebframework.web.api.crud.entity.RecordModifierEntity;
import org.hswebframework.web.crud.annotation.EnableEntityEvent;
import org.hswebframework.web.crud.generator.Generators;
import org.hswebframework.web.validator.CreateGroup;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;


@Getter
@Setter
@Table(name = "biz_data_analysis_interpretation_condition")
@Comment("实验数据分析阴阳判断条件")
@EnableEntityEvent
public class DataAnalysisInterpretationConditionEntity extends GenericEntity<String> implements RecordCreationEntity, RecordModifierEntity {
    @Override
    @Id
    @Column(length = 64, updatable = false)
    @Schema(description = "ID")
    @GeneratedValue(generator = Generators.SNOW_FLAKE)
    @NotBlank(message = "ID不能为空", groups = CreateGroup.class)
    public String getId() {
        return super.getId();
    }

    @Column(name = "creator_id", updatable = false)
    @Schema(
        description = "创建者ID(只读)"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String creatorId;

    @Column(name = "creator_user_name", updatable = false)
    @Schema(
        description = "创建者账号(只读)"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String creatorUserName;

    @Column(name = "creator_name", updatable = false)
    @Schema(
        description = "创建者名称(只读)"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String creatorName;


    @Column(name = "create_time", updatable = false)
    @DefaultValue(generator = Generators.CURRENT_TIME)
    @Schema(
        description = "创建时间(只读)"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private Long createTime;

    @Column
    @DefaultValue(generator = Generators.CURRENT_TIME)
    @Schema(
        description = "修改时间"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private Long modifyTime;

    @Column(length = 64)
    @Schema(
        description = "修改人ID"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String modifierId;

    @Column(length = 64)
    @Schema(
        description = "修改人名称"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String modifierName;


    @Column(name = "group_id", length = 64)
    @Schema(description = "分组ID")
    private String groupId;
    @Column(name = "condition_type", length = 10)
    @Schema(description = "条件类型，阴性、阳性")
    private String conditionType; // 条件类型
    @Column(name = "type", length = 10)
    @Schema(description = "CT值/TM值")
    private String type;      // CT值/TM值
    @Column(name = "sub_type", length = 10)
    @Schema(description = "FAM/VIC/Cy5/ROX")
    private String subType;   // FAM/VIC/Cy5/ROX
    @Column(name = "operator", length = 50)
    @Schema(description = "操作符")
    private String operator;  // 操作符
    @Column(name = "value1", length = 20, precision = 8, scale = 2)
    @Schema(description = "数值1")
    private Double value1;    // 数值1
    @Column(name = "value2", length = 20, precision = 8, scale = 2)
    @Schema(description = "数值2")
    private Double value2;    // 数值2
    @Column(name = "sort", length = 20)
    @Schema(description = "排序")
    private Integer sort;     // 排序
    //连接字符 AND/OR
    @Column(name = "connector", length = 10)
    @Schema(description = "连接字符AND/OR 排序>=2时有值")
    private String connector;
}